package dr.incomeapp.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import dr.incomeapp.R;

public class GridItem extends LinearLayout {

	protected int title;
	protected int layout;
	protected int image;

	public GridItem(Context c) {
		super(c);
		LayoutInflater mInflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mInflater.inflate(R.layout.grid_item, this, true);
	}

	public GridItem(Context c, int title) {
		super(c);
		LayoutInflater mInflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mInflater.inflate(R.layout.grid_item, this, true);
		setTitle(title);
	}

	public GridItem(Context c, int title, int image) {
		super(c);
		LayoutInflater mInflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mInflater.inflate(R.layout.grid_item, this, true);
		setTitle(title);
		setImage(image);
	}

	public GridItem(Context c, String title, int image) {
		super(c);
		LayoutInflater mInflater = (LayoutInflater) c
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mInflater.inflate(R.layout.grid_item, this, true);
		setTitle(title);
		setImage(image);
	}

	public void setTitle(String title) {
		TextView tv = (TextView) this.findViewById(R.id.tvTitle);
		tv.setText(title);
	}

	public void setTitle(int title) {
		TextView tv = (TextView) this.findViewById(R.id.tvTitle);
		tv.setText(title);
	}

	public void setImage(int image) {
		ImageView iv = (ImageView) this.findViewById(R.id.ivImage);
		// iv.setBackgroundResource(image);
		iv.setImageResource(image);
	}

}
